<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Jedrzej\Pimpable\PimpableTrait;
use Illuminate\Database\Eloquent\SoftDeletes;

class OrderLog extends Model
{
    use HasFactory;
    use PimpableTrait;

    /**
     * 表中的类型状态 无
     */

    /**
     * 可搜索字段
     */
    public $searchable = [
        'order_id'
    ];

    /**
     * 可批量赋值字段
     */
    public $fillable = [
        'change_type',
        'change_message'
    ];

    /**
     * 可排序字段
     */
    public $sortable = ['created_at', 'id'];

    /**
     * 默认排序字段
     */
    protected $defaultSortCriteria = ['id,desc'];

    /**
     * 关联的订单
     */
    function order(){
        return $this->belongsTo(Order::class,'order_id','id');
    }

}
